

package util.encrypt.apache_commons;

import org.apache.commons.codec.binary.Base64;
import util.file.FileUtil;



//http://stackoverflow.com/questions/20227/how-do-i-use-3des-encryption-decryption-in-java
public class CriptoTripleDESTest {
    public static void main(String[] args) throws Exception {

        CriptoTripleDES crip = new CriptoTripleDES("123");
        
    	//String text1 = "!#$%&/()=?¿¡áéíóúñÑ<>-_{}[]^¨ü@";
    	String text1 = "<a> Ñ";
        
    	//String codedtext;
        //codedtext = crip.encrypt(text1);
    	//String decodedtext1 = crip.decrypt(codedtext);
                
        byte[] codedtext;
        codedtext = crip.encryptToBytes(text1);
    	String decodedtext1 = crip.decrypt(codedtext);
        
        String data = Base64.encodeBase64String(codedtext);
        System.out.println(data);
    	System.out.println(decodedtext1);
    	//System.out.println(decodedtext2);
    	//System.out.println(decodedtext3);
        FileUtil.escribirArchivo("d:/cripto.txt", data);
    }

    
}
